package com.example.hospital.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.hospital.mapper.BasicMapper;
import com.example.hospital.pojo.Basic;
import com.example.hospital.pojo.ResPageBean;
import com.example.hospital.service.IBasicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IBasicServiceImpl extends ServiceImpl<BasicMapper,Basic> implements IBasicService {
    @Autowired
    private BasicMapper basicMapper;
    @Override
    public ResPageBean getBasicByPage(Integer currentPage, Integer size,String keyword) {
        Page<Basic> page = new Page<>(currentPage,size);
        IPage<Basic> basicByPage = basicMapper.getBasicByPage(page,keyword);
        ResPageBean resPageBean = new ResPageBean(basicByPage.getTotal(),basicByPage.getRecords());
        return resPageBean;
    }
}
